<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <h1>cookie</h1>

    <hr>

    <script>
        document.write('读取cookie: ' + document.cookie +'<br>');

        document.cookie = 'sex=11';
        document.write('读取cookie: ' + document.cookie + '<br>');


        document.cookie = 'sex2=6; path = /';
        document.write('读取cookie: ' + document.cookie + '<br>');

        var d = new Date();
        d.seTime(d.getTime() + 3600*1000);

        document.cookie = 'sex3 = 999; path = /; expires = ' + d.toUTCString();
    </script>
</body>
</html>